package com.browner.game;
import java.util.*;

public class Monster {
	
	private static Random rand = new Random();
	
	private int health;
	private int attack;
	private int defense;
	private int level;
	
	public Monster(int level1) {
		health = 10;
		attack = 0;
		defense = 0;
		level = level1;
	}
	
	public void setHealth(int health1) {
		health = health1;
	}
	
	public int getHealth() {
		return health;
	}
	
	public int getAtatck() {
		return attack;
	}
	
	public int getDefense() {
		return defense;
	}
	
	public int getLevel() {
		return level;
	}
	
	public int attack(int playerDef) {
		int dmg = rand.nextInt(6) + 5 + attack - playerDef;
		System.out.println("The monster attacked. You took "+dmg+" damage!");
		return dmg;
	}
	
	//returns true if it dies, else returns false
	public boolean damage(int dmg) {
		health -= dmg + defense;
		if(health <= 0) {
			health = 0;
			return true;
		}
		else return false;
	}
}
